HelpControl   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 41
c 0
b 0
f 0
dl 0
loc 44
rs 10
wmc 3

2 Functions

Rating   Name   Duplication   Size   Complexity  
A componentDidMount 0 6 1
A render 0 35 2
1
import React from 'react'
2
import ReactSVG from 'react-svg'
3
import PropTypes from 'prop-types'
4
import askusIcon from '../images/ask-us.svg'
5
6
class HelpControl extends React.Component {
7
  // Load LibChat script
8
  componentDidMount() {
9
    let e = document.createElement('script')
10
    e.src =
11
      '//v2.libanswers.com/load_chat.php?hash=07713bc057f66ebcdccd4dd1b4a2be3e'
12
    document.body.appendChild(e)
13
  }
14
15
  render() {
16
    return (
17
      <div
18
        className={
19
          this.props.open ? 'header__control--active' : 'header__control'
20
        }
21
      >
22
        <button className="header__control-button" onClick={this.props.handler}>
23
          <div className="header__control-icon">
24
            <ReactSVG path={askusIcon} />
25
          </div>
26
          Ask us
27
        </button>
28
29
        <div className="header__control-popout" style={{ width: '12rem' }}>
30
          <div className="header__popout-setting">
31
            Text: <a href="tel:5207627271">(520) 762-7271</a>
32
          </div>
33
          <div className="header__popout-setting">
34
            Phone: <a href="tel:5206216442">(520) 621-6442</a>
35
          </div>
36
          <div className="header__popout-setting">
37
            Email: <a href="mailto:[email protected]">[email protected]</a>
38
          </div>
39
          <div className="header__popout-setting">
40
            <div id="libchat_07713bc057f66ebcdccd4dd1b4a2be3e" />
41
          </div>
42
          <div className="header__popout-setting">
43
            <a href="http://new.library.arizona.edu/contact">
44
              More contact information
45
            </a>
46
          </div>
47
        </div>
48
      </div>
49
    )
50
  }
51
}
52
53
export default HelpControl
54